package com.example.securitymy.controller;

import com.example.securitymy.domain.ResponseResult;
import com.example.securitymy.domain.dto.ResetPasswordDto;
import com.example.securitymy.service.PasswordResetService;
import com.example.securitymy.service.VerificationCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/password")
public class PasswordResetController {

    @Autowired
    private VerificationCodeService verificationCodeService;

    @Autowired
    private PasswordResetService passwordResetService;

    @PostMapping("/send-code")
    public ResponseResult sendVerificationCode(@RequestParam String email) {
        System.out.println(email);
        return verificationCodeService.sendVerificationCode(email);
    }

    @PostMapping("/reset")
    public ResponseResult resetPassword(@RequestBody ResetPasswordDto resetPasswordDto) {
        return passwordResetService.resetPassword(resetPasswordDto);
    }
} 